package com.itec.learn.java.design.factory.abstractFactory;

import com.itec.learn.java.design.factory.Pizza;
import com.itec.learn.java.design.factory.SimplePizza;
import com.itec.learn.java.design.factory.method.AbstractPizzaStore;

/**
 * @author chenyiqun
 */
public class NewChicagoPizzaStore extends AbstractPizzaStore {
    @Override
    public Pizza createPizza(String type) {
        //纽约原料工厂
        PizzaIngredientFactory factory = new ChicagoPizzaIngredientFactory();
        Pizza pizza;
        if (type.equals("cheese")){
            pizza = new NewCheesePizza(factory);
        } else if (type.equals("greek")){
            pizza = new NewGreekPizza(factory);
        } else {
            pizza = new SimplePizza();
        }
        pizza.setType(type);
        pizza.setStyle("纽约");
        return pizza;
    }
}
